﻿using AutoMapper;
using EiiF_Blog;
using EiiF_Blog.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Blog.webapi.Utility
{
    public class MapperProfile:Profile
    {
        public MapperProfile()
        {
            base.CreateMap<Author, AuthorDto>();
            base.CreateMap<BlogNews, BlogNewsDto>()
                .ForMember(dest => dest.TypeName, sourse => sourse.MapFrom(src => src.type.Name))
                .ForMember(dest => dest.AuthorName, sourse => sourse.MapFrom(src => src.author.Name));
        }
    }
}
